import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:flutter_todolist/pages/home/task.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../util.dart';
import 'home.dart';

class BottomNavigationBarApp extends StatelessWidget {
  final int bottomNavigationBarIndex;
  final BuildContext context;
  final Function(int index)? onTap;

  const BottomNavigationBarApp(
    this.context,
    this.bottomNavigationBarIndex,
    this.onTap,
    {Key? key}) : super(key: key);

  // void onTabTapped(int index) {
  //   Navigator.of(context).push(
  //     MaterialPageRoute<Null>(builder: (BuildContext context) {
  //       return (index == 1) ? Task() : Home();
  //     }),
  //   );
  // }

  @override
  Widget build(BuildContext context) {
    return BottomNavigationBar(
      currentIndex: bottomNavigationBarIndex,
      type: BottomNavigationBarType.fixed,
      selectedFontSize: 10,
      selectedLabelStyle: TextStyle(color: CustomColors.BlueDark),
      selectedItemColor: CustomColors.BlueDark,
      unselectedFontSize: 10,
      items: [
        BottomNavigationBarItem(
          icon: Container(
            margin: const EdgeInsets.only(bottom: 5),
            child: FaIcon(FontAwesomeIcons.house, color: (bottomNavigationBarIndex == 0)
                ? CustomColors.BlueDark
                : CustomColors.TextGrey, size: 25.r),
          ),
          label: 'Home',
        ),
        BottomNavigationBarItem(
          icon: Container(
            margin: const EdgeInsets.only(bottom: 5),
            child: FaIcon(FontAwesomeIcons.layerGroup, color: (bottomNavigationBarIndex == 1)
                ? CustomColors.BlueDark
                : CustomColors.TextGrey, size: 25.r),
          ),
          label: 'Task',
        ),
      ],
      onTap: onTap,
    );
  }
}
